<?php 
require_once 'include.php';
$cates=getAllcate();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>筛选页</title>
<link type="text/css" rel="stylesheet" href="styles/reset.css">
<link type="text/css" rel="stylesheet" href="styles/main.css">
<script src="js/jquery-1.6.js" type="text/javascript"></script>
<!--[if IE 6]>
<script type="text/javascript" src="js/DD_belatedPNG_0.0.8a-min.js"></script>
<script type="text/javascript" src="js/ie6Fixpng.js"></script>
<![endif]-->
</head>

<body>
<?php include ('header.php');?>
<div class="hr_15"></div>
<div class="comWidth clearfix products">
	<div class="leftArea">
		<div class="leftNav vertical">
			<h3 class="nav_title">分类列表</h3>
			<div class="nav_cont">
				<h3>手机通讯</h3>
				<ul class="navCont_list clearfix">
				<?php foreach($cates as $cate):?>
					<li><a href="?cateid=<?php echo $cate['id']?>&cname=<?php echo $cate['cName']?>"><?php echo $cate['cName']?></a></li>
				<?php endforeach;?>
				</ul>
			</div>
		</div>
	</div>
	<div class="rightArea">
		<div class="addInfo">
			<div class="address">
				<span class="add_text"><?php echo $_REQUEST['cname']?>-商品列表</span>
			</div>
		</div>
		<div class="hr_15"></div>
		<div class="products_list screening_list_more clearfix">
		<?php 
		     $pros=$_REQUEST['cateid']?getProsByCid($_REQUEST['cateid']):getAllPros();
			if($pros &&is_array($pros)):
			foreach($pros as $pro):
			$proImg=getProImgById($pro['id']);
		?>
			<div class="item">
				<div class="item_cont">
					<div class="img_item">
						<a href="proDetails.php?id=<?php echo $pro['id'];?>" target="_blank"><img src="image_220/<?php echo $proImg['albumPath'];?>" alt=""></a>
					</div>
					<p><a href="proDetails.php?id=<?php echo $pro['id'];?>" target="_blank"><?php echo $pro['pName'];?></a></p>
					<p class="money">￥<?php echo $pro['iPrice'];?></p>
					<p><a href="javascript:addCart(<?php echo $pro['id']?>,<?php echo $pro['iPrice']?>);" class="addCar">加入购物车</a></p>
				</div>
				<?php if($pro['isHot']):?>
				<div class="hot"></div>
				<?php endif;?>
			</div>
			<?php endforeach;
                endif;
			 ?>
		</div>
		<script>
			function addCart(productid,price){
				var url="doAction.php?act=addCart";
				var data={"productid":productid,"num":1,"price":price};
				var success=function(response){
    					if(response.errno==0){
    				        alert("加入购物车成功");
    				    }else if(response.errno==-2){
    				        alert("请先登陆");
    				    }else{
    				    	alert("加入购物车失败");
    				    }
					}
				$.post(url,data,success,"json");
			}
		</script>
		<div class="hr_25"></div>
		<div class="page">
			<a href="#">上一页</a><a href="#">1</a><a href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="#">6</a><span class="hl">...</span><a href="#">200</a><a href="#">下一页</a><span class="morePage">共200页，到第</span><input type="text" class="pageNum"><span class="ye">页</span><input type="button" value="确定" class="page_btn">
		</div>
	</div>
</div>
<div class="hr_25"></div>
<?php include ('footer.php');?>
</body>
</html>
